<template>
  <div>
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item>
        <el-input v-model="searchObj.hosname" placeholder="医院名称"/>
      </el-form-item>
      <el-form-item>
        <el-input v-model="searchObj.hoscode" placeholder="医院编号"/>
      </el-form-item>
      <el-button type="primary" icon="el-icon-search" @click="getList()">查询</el-button>
      <el-button type="warning" icon="el-icon-refresh-right" @click="reset">重置</el-button>
    </el-form>

    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
      <el-table-column
        type="index"

        label="序号"
        width="120">
      </el-table-column>
      <el-table-column
        prop="hosname"
        label="医院名称"
        width="120">
      </el-table-column>
      <el-table-column
        prop="apiUrl"
        label="api基础路径"
        width="220">
      </el-table-column>
      <el-table-column
        prop="hoscode"
        label="医院编号"
        width="120">
      </el-table-column>

      <el-table-column
        prop="contactsName"
        label="联系人姓名"
        width="120">
      </el-table-column>

      <el-table-column
        prop="contactsPhone"
        label="联系人姓名"
        width="120">
      </el-table-column>

      <el-table-column
        label="状态"
      >
        <template slot-scope="scope">
          {{ scope.row.status === 1 ? '启用' : '禁用' }}
        </template>
      </el-table-column>


    </el-table>
    <div>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="current"
        :page-sizes="[2,5, 10, 15, 20]"
        :page-size="limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>

    </div>
  </div>


</template>

<script>
//引入接口定义文件
import hospset from "@/api/hospset";

export default {
  name: "list",
  //设置数据
  data() {
    return {
      current: 1,//当前页
      limit: 2,//每页显示条数
      searchObj: {},//搜索对象
      list: [],//列表数据
      total: 0,//总条数
      tableData: [],//表格数据
      multipleSelection: [],//多选数据
    }
  },
  created() {//页面创建完成
    this.getList();
  },
  methods: {
    //医院设置列表方法
    getList() {
      hospset.getHospSetList(this.current, this.limit, this.searchObj).then(res => {
        this.tableData = res.data.records;
        this.total = res.data.total;
      }).catch(err => {
        console.log(err);
      })
    },
    //页码改变
    handleSizeChange(limit) {
      this.limit = limit;
      this.getList();
    },
    //当前页改变
    handleCurrentChange(current) {
      this.current = current;
      this.getList();
    },
    //多选  批量删除
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //批量删除

    //重置
    reset() {
      this.searchObj = {};
      this.getList();
    },


  },


}
</script>

<style scoped>

</style>
